#include "mysortfilterproxymodel.h"

MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent) :
    QSortFilterProxyModel(parent)
{

}
void MySortFilterProxyModel::setFilterKeyColumns(const QList<qint32> &filterColumns)
{
    m_columnPatterns.clear();

    foreach(qint32 column, filterColumns)
        m_columnPatterns.insert(column, QString());
}

void MySortFilterProxyModel::addFilterFixedString(qint32 column, const QString &pattern)
{
    if(!m_columnPatterns.contains(column))
        return;

    m_columnPatterns[column] = pattern;

}
//bool MySortFilterProxyModel::filterAcceptsRow(int sourceRow,
//        const QModelIndex &sourceParent) const
//{
//    QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
//    QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
//    QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);

//    return (sourceModel()->data(index0).toString().contains(filterRegExp())
//            || sourceModel()->data(index1).toString().contains(filterRegExp()));
//}
